<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <title>提示文字跳起来的输入框</title>
    <style>
        .app {
            width: 100%;
            height: 100vh;
            background-color: #ffffff;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .label35 {
            width: 180px;
            position: relative;
            cursor: text;
        }

        .inp35 {
            width: 100%;
            padding: 0 10px;
            height: 42px;
            border: 0;
            border-bottom: 2px solid #414141;
            font-size: 16px;
            outline: none;
            box-sizing: border-box;
            transition: .3s;
        }

        .span35-box {
            width: 100%;
            padding: 0 10px;
            color: #aaa;
            font-size: 16px;
            position: absolute;
            top: 9px;
            box-sizing: border-box;
            display: flex;
        }

        .span35-info {
            transition: .3s cubic-bezier(0.5, -0.5, 0.5, 1.5);
        }

        .span35-info:nth-of-type(2) {
            transition-delay: 100ms;
        }

        .span35-info:nth-of-type(3) {
            transition-delay: 200ms;
        }

        .inp35:focus+.span35-box .span35-info,
        .inp35:valid+.span35-box .span35-info {
            color: #3034d4;
            transform: translateY(-30px);
        }

        .inp35:focus,
        .inp35:valid {
            border-bottom: 2px solid #3034d4;
        }
    </style>
</head>

<body>
    <div class="app">
        <label class="label35">
            <input class="inp35" type="text" required>
            <span class="span35-box">
                <span class="span35-info">用</span>
                <span class="span35-info">户</span>
                <span class="span35-info">名</span>
            </span>
        </label>
    </div>
</body>

</html>